<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<script type="text/javascript">

function imgcallback(filePath, imgT) {
	var a = document.getElementById(imgT);
	a.value = filePath;
}
function findSupplier(){
	asyncbox.open({
		url : "pricemanager/Channel/findSupplier.jsp",
		width : 850,
		height : 450,
		top : 65,
		drag : false,
		modal : true,
		scrolling : "yes",
		title : "供应商信息",
		tipsbar : {
			title : '供应商信息',
			content : '供应商信息'
		},
		btnsbar : $.btn.OKCANCEL,
		callback : function(action,iframe,returnValue){
			if(action == 'ok'){
				var strs = returnValue.split("|:,:|");
				$("#sName_modifyChannel").attr("value",strs[1]);
				$("#sNum_modifyChannel").attr("value",strs[0]);
			}else{
				
			}
		}
	});
}
</script>

<div class="pageContent">

	<form method="post" id="modifyForm"
		action="<%=basePath%>channel_modify.action"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, navTabAjaxDone)">
		<div class="pageFormContent2" layoutH="58">
			<input type="hidden" name="channel.PChannelNumber"
				value="${requestScope.channel.channel.PChannelNumber}" />
				<input type="hidden" name="channel.PChannelId"
				value="${requestScope.channel.channel.PChannelId}" />
			<p>
				<label>
					渠道编码：
				</label>
				<input type="text" size="30"
					minlength="5" maxlength="20" readonly="readonly"
					value="${requestScope.channel.channel.PChannelNumber }" />
			</p>
			<p>
				<label>
					渠道商
				</label>
				<input id="sNum_modifyChannel" name="channel.PClineNumber" value="${requestScope.channel.channel.PClineNumber}" type="hidden" />
				<input id="sName_modifyChannel" value="${requestScope.channel.supplierName}" type="text" size="25" readonly="readonly" /><input type="button" onclick="findSupplier()" value="..." />
			</p>
			<p>
				<label>
					渠道名称：
				</label>
				<input type="text" name="channel.PChannelName" size="30"
					minlength="3" maxlength="20" class="required"
					value="${requestScope.channel.channel.PChannelName }" />
			</p>
			<p>
				<label>
					渠道别名：
				</label>
				<input type="text" name="channel.PChannelAlias" size="30" minlength="3" maxlength="20"
					value="${requestScope.channel.channel.PChannelAlias}" />
			</p>
			<p>
				<label>
					渠道类别：
				</label>
				<select name="channel.PClassNumber" id="channeltype"
					class="required combox">
					<option value="">
						请选择
					</option>
					<c:forEach items="${sessionScope.channelClasses}" var="chanClass">
						<option id="${chanClass.PClassNumber}"
							value="${chanClass.PClassNumber}">
							${chanClass.PClassName}
						</option>
					</c:forEach>
				</select>
				<input type="hidden" id="cType"
					value="${requestScope.channel.channel.PClassNumber}" />
			</p>
			<p>
				<label>
					物流模式：
				</label>
				<select id="model" name="channel.PChannelMode"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="PT">
						国际小包
					</option>
					<option value="IE">
						国际快递
					</option>
					<option value="DC">
						国内物流
					</option>
					<option value="AT">
						空运
					</option>
					<option value="SG">
						海运
					</option>
					<option value="WG">
						仓储
					</option>
				</select>
			</p>
			<p>
				<label>
					材积计算(除数)：
				</label>
				<select id="caiji" name="channel.PChannelVolume"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="5000">
						5000
					</option>
					<option value="5500">
						5500
					</option>
					<option value="6000">
						6000
					</option>
				</select>
			</p>
			<p>
				<label>
					结算重量规则：
				</label>
				<select id="accountType" name="channel.PChannelRule"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="1">
						材重
					</option>
					<option value="2">
						实重
					</option>
					<option value="3">
						(材重+实重)/2
					</option>
				</select>
			</p>
			<p>
				<label>
					小货进位标准：
				</label>
				<select id="SCARRY" name="channel.PChannelScarry"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="0.001">
						0.001
					</option>
					<option value="0.008">
						0.008
					</option>
					<option value="0.01">
						0.01
					</option>
					<option value="0.05">
						0.05
					</option>
					<option value="0.1">
						0.1
					</option>
					<option value="0.5">
						0.5
					</option>
					<option value="1">
						1
					</option>
				</select>
			</p>
			<p>
				<label>
					大货进位标准：
				</label>
				<select id="BCARRY" name="channel.PChannelBcarry"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="0.5">
						0.5
					</option>
					<option value="1">
						1
					</option>
				</select>
			</p>
			<p>
				<label>
					偏远最低金额：
				</label>
				<input type="text" name="channel.PChannelRemote" size="20"
					class="number required"
					value="${requestScope.channel.channel.PChannelRemote}" />
			</p>
			<p>
				<label>
					偏远计算公式：
				</label>
				<input type="text" name="channel.PChannelRformula" size="20"
					class="required"
					value="${requestScope.channel.channel.PChannelRformula}" />
			</p>
			<p>
				<label>
					偏远是否含燃油：
				</label>
				<select id="FUEL" name="channel.PChannelFuel"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="false">
						不包含
					</option>
					<option value="true">
						包含
					</option>
				</select>
			</p>
			<p>
				<label>
					挂号费(公式)：
				</label>
				<input type="text" name="channel.PChannelRegistrationFee" size="20"
					class="required"
					value="${requestScope.channel.channel.PChannelRegistrationFee}" />
			</p>
			<p>
				<label>
					操作费(公式)：
				</label>
				<input type="text" name="channel.PChannelOperatCosts" size="20"
					class="required"
					value="${requestScope.channel.channel.PChannelOperatCosts}" />
			</p>
			<p>
				<label>
					其他费用(公式)：
				</label>
				<input type="text" name="channel.PChannelOtherFee" size="20"
					class="required"
					value="${requestScope.channel.channel.PChannelOtherFee}" />
			</p>
			<p>
				<label>
					适用类别：
				</label>
				<select id="useType" name="channel.PChannelClass"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="1">
						出货
					</option>
					<option value="2">
						收货
					</option>
				</select>
			</p>
			<p>
				<label>
					起始分区数：
				</label>
				<input type="text" name="channel.PChannelSPartition" size="20"
					class="required digits"
					value="${requestScope.channel.channel.PChannelSPartition}" />
			</p>
			<p>
				<label>
					目的分区数：
				</label>
				<input type="text" name="channel.PChannelEPartition" size="20"
					class="required digits"
					value="${requestScope.channel.channel.PChannelEPartition}" />
			</p>
			<p>
				<label>
					渠道单号生成规则：
				</label>
				<select id="REGISTERED" name="channel.registeredClassname"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="CY">
						以公司为主
					</option>
					<option value="CL">
						以渠道为主
					</option>
					<option value="NO">
						不生成
					</option>
				</select>
			</p>
			<p>
				<label>
					递送时间：
				</label>
				<input type="text" name="channel.PChannelSpeedTime" size="20"
					class="required "
					value="${requestScope.channel.channel.PChannelSpeedTime}" />
			</p>
			<p>
				<label>
					状态：
				</label>
				<select id="chstatus" name="channel.PChannelStatus"
					class="required combox">
					<option value="">
						请选择
					</option>
					<option value="CL">
						停用
					</option>
					<option value="NE">
						启用
					</option>
				</select>
			</p>
			<p>
				<label>
					航空标签图片：
				</label>
				<iframe name="airIframe"
					src="<%=basePath%>/backgroundManager/pricemanager/Channel/imgFileUpload.jsp?imgT=imgAir"
					width="200" height="40" scrolling="no"></iframe>
				<input type="hidden" id="imgAir" name="channel.PChannelImgAir"
					value="${requestScope.channel.channel.PChannelImgAir}" />
			</p>
			<p>
				<label>
					特许码图片：
				</label>
				<iframe name="codeIframe"
					src="<%=basePath%>/backgroundManager/pricemanager/Channel/imgFileUpload.jsp?imgT=imgCode"
					width="200" height="40" scrolling="no"></iframe>
				<input type="hidden" id="imgCode" name="channel.PChannelImgCode"
					value="${requestScope.channel.channel.PChannelImgCode}" />
			</p>
			<p>
				<label>
					渠道标识图片：
				</label>
				<iframe name="channelIframe"
					src="<%=basePath%>/backgroundManager/pricemanager/Channel/imgFileUpload.jsp?imgT=imgChannel"
					width="200" height="40" scrolling="no"></iframe>
				<input type="hidden" id="imgChannel" name="channel.PChannelImgC"
					value="${requestScope.channel.channel.PChannelImgC}" />
			</p>
			<p>
				<label>
					排序：
				</label>
				<input type="text" name="channel.PChannelSort" size="6"
					class="digits" value="${requestScope.channel.channel.PChannelSort}" />
			</p>
			<p>
				<label>
					添加时间：
				</label>
				<fmt:formatDate
					value="${requestScope.channel.channel.PChannelAddDate}" type="date"
					dateStyle="long" />
			</p>
			<p>
				<label>
					渠道说明：
				</label>
				<textarea cols="50" rows="5" name="channel.PChannelNote">${requestScope.channel.channel.PChannelNote}</textarea>
			</p>
		</div>
		<div class="formBar">
			<ul>
				<li>
					<div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">
								保存
							</button>
						</div>
					</div>
				</li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">
								取消
							</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>

</div>
<script type="text/javascript">
(function(){
		var cType = document.getElementById("cType").value;
		var a = document.getElementById(cType);
		a.selected = "true";
		
		var b = document.getElementById("model");
		switch("${requestScope.channel.channel.PChannelMode}"){
			case "PT":
				b.options.selectedIndex = 1;
				break;
			case "IE":
				b.options.selectedIndex = 2;
				break;
			case "DC":
				b.options.selectedIndex = 3;
				break;
			case "AT":
				b.options.selectedIndex = 4;
				break;
			case "SG":
				b.options.selectedIndex = 5;
			case "WG":
				b.options.selectedIndex = 6;
				break;
		}
		
		var c = document.getElementById("caiji");
		switch(${requestScope.channel.channel.PChannelVolume}){
			case 5000:
				c.options.selectedIndex = 1;
				break;
			case 5500:
				c.options.selectedIndex = 2;
				break;
			case 6000:
				c.options.selectedIndex = 3;
				break;
		}
		
		var d = document.getElementById("accountType");
		switch(${requestScope.channel.channel.PChannelRule}){
			case 1:
				d.options.selectedIndex = 1;
				break;
			case 2:
				d.options.selectedIndex = 2;
				break;
			case 3:
				d.options.selectedIndex = 3;
				break;
		}
		
		var e = document.getElementById("SCARRY");
		switch(${requestScope.channel.channel.PChannelScarry}){
			case 0.001:
				e.options.selectedIndex = 1;
				break;
			case 0.008:
				e.options.selectedIndex = 2;
			case 0.01:
				e.options.selectedIndex = 3;
				break;
			case 0.05:
				e.options.selectedIndex = 4;
				break;
			case 0.1:
				e.options.selectedIndex = 5;
				break;
			case 0.5:
				e.options.selectedIndex = 6;
				break;
			case 1:
				e.options.selectedIndex = 7;
				break;
		}
		
		var f = document.getElementById("BCARRY");
		switch(${requestScope.channel.channel.PChannelBcarry}){
			case 0.5:
				f.options.selectedIndex = 1;
				break;
			case 1:
				f.options.selectedIndex = 2;
				break;
		}
		
		var g = document.getElementById("FUEL");
		if(${requestScope.channel.channel.PChannelFuel}){
			g.options.selectedIndex = 2;
		}else{
			g.options.selectedIndex = 1;
		}
		
		var h = document.getElementById("useType");
		switch(${requestScope.channel.channel.PChannelClass}){
		 	case 1:
		 		h.options.selectedIndex = 1;
		 		break;
		 	case 2:
		 		h.options.selectedIndex = 2;
		 		break;
		 	case 3:
		 		h.options.selectedIndex = 3;
		 		break;
		 	case 4:
		 		h.options.selectedIndex = 4;
		 		break;
		 }
		
		var i= document.getElementById("REGISTERED");
		switch("${requestScope.channel.channel.registeredClassname}"){
			case "CY":
				i.options.selectedIndex = 1;
				break;
			case "CL":
				i.options.selectedIndex = 2;
				break;
			case "NO":
				i.options.selectedIndex = 3;
				break;
		}
		
		var j= document.getElementById("chstatus");
		switch("${requestScope.channel.channel.PChannelStatus}"){
			case "CL":
				j.options.selectedIndex = 1;
				break;
			case "NE":
				j.options.selectedIndex = 2;
				break;
		}
		
	})();
</script>

